package me.seu.demo.test;

/**
 * @author liangfeihu
 * @since 2020/1/6 18:16
 */
public class DoubleAndString {
    public static void main(String[] args) {
        String relPay = "101.25";
        System.out.println(Double.valueOf(relPay));
        Double pay = Double.valueOf(relPay);
        Double zero = 200d;
        System.out.println(pay.compareTo(zero));
        Double value = Double.valueOf("51.03");
        System.out.println(pay - value);

        System.out.println(formatDouble("80.3"));
        System.out.println(formatDouble("85.3"));
        System.out.println(formatDouble("82.8"));
    }

    public static String formatDouble(String dVal) {
        Double val = Double.valueOf(dVal);
        double v = val / 100;
        String format = String.format("%.2f", v);
        return format;
    }
}
